/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.sys.service.firm;

import java.util.List;
import java.util.Map;

import com.thinkgem.jeesite.modules.sys.dao.customer.CustomerDao;
import com.thinkgem.jeesite.modules.sys.entity.customer.Customer;
import com.thinkgem.jeesite.modules.sys.entity.firm.tonji;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.sys.entity.firm.Firm;
import com.thinkgem.jeesite.modules.sys.dao.firm.FirmDao;

/**
 * firmService
 * @author jin
 * @version 2018-04-23
 */
@Service
@Transactional(readOnly = true)
public class FirmService extends CrudService<FirmDao, Firm> {

	@Autowired
	private FirmDao firmDao;

	public Firm get(String id) {
		return super.get(id);
	}
	
	public List<Firm> findList(Firm firm) {
		return super.findList(firm);
	}

	public List<Firm> findList1(Firm firm){ return dao.findList1(firm);}

	public Page<Firm> findPage1(Page<Firm> page, Firm firm) {
		firm.getSqlMap().put("dsf", dataScopeFilter(firm.getCurrentUser(), "o7", ""));
		firm.setPage(page);
		page.setList(dao.findList1(firm));
		return page;
	}
	
	public Page<Firm> findPage(Page<Firm> page, Firm firm) {
		firm.getSqlMap().put("dsf", dataScopeFilter(firm.getCurrentUser(), "o7", ""));
		return super.findPage(page, firm);
	}

//	public Page<Firm> findPage1(Page<Firm> page, Firm firm) {
//		firm.getSqlMap().put("dsf", dataScopeFilter(firm.getCurrentUser(), "o7", ""));
//		return dao.findPage1(page, firm);
//	}

	public Page<Firm> findUser(Page<Firm> page, Firm firm) {
		// 生成数据权限过滤条件（dsf为dataScopeFilter的简写，在xml中使用 ${sqlMap.dsf}调用权限SQL）
//		firm.getSqlMap().put("dsf", dataScopeFilter(firm.getCurrentUser(), "o", "a"));
		// 设置分页参数
		firm.setPage(page);
		// 执行分页查询
		page.setList(firmDao.findList(firm));
		return page;
	}

	public Page<Firm> findUser1(Page<Firm> page, Firm firm) {
		// 生成数据权限过滤条件（dsf为dataScopeFilter的简写，在xml中使用 ${sqlMap.dsf}调用权限SQL）
//		firm.getSqlMap().put("dsf", dataScopeFilter(firm.getCurrentUser(), "o", "a"));
		// 设置分页参数
		firm.setPage(page);

		// 执行分页查询
		page.setList(firmDao.findList(firm));
		return page;
	}
	
	@Transactional(readOnly = false)
	public void save(Firm firm) {
		super.save(firm);
	}
	
	@Transactional(readOnly = false)
	public void delete(Firm firm) {
		super.delete(firm);
	}

	public List<Firm> getAll(){
		return dao.getAll();
	}

	public List<Map<String,Object>> tonJi(String officeId){return dao.tonJi(officeId);}

	public List<tonji> ztonji(){return dao.ztonji();}

	public List<Firm> getStatic(String memberName){ return dao.getStatic(memberName);}

	public String tonJijg(String OfficeId){ return  dao.tonJijg(OfficeId);}

	public String getSum(){return dao.getSum();}

	public List<Firm> getchoose(Firm firm){
	    return  dao.getchoose(firm);
    }

	public List<Firm> getchoose1(Firm firm){
		return  dao.getchoose1(firm);
	}

	public List<Map<String,Object>> bingMap(){ return dao.bingMap();}

	public List<Map<String,Object>> getBing(String ywStatic){ return dao.getBing(ywStatic);}
	
}